<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0;">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="../static/css/reset.css">
    <link rel="stylesheet" href="../static/css/base.css">
    <link rel="stylesheet" href="../static/css/zhihuan.css">   
    <title>车辆置换</title>
</head>
<body>
    <div class="main">
       <div class="tit">请填写车辆置换的相关信息</div>
       <div class="wrap">
           <div class="item">
               <div class="l">置换车型</div>
               <div class="r">
                   <input class="ipt" type="text" name="" id="infoBy1" placeholder="请输入您的置换车型">
               </div>
           </div>
           <div class="item">
                <div class="l">上牌时间</div>
                <div class="r c">
                    <!-- <input class="ipt" type="text" name="" id="infoBy2" placeholder="上牌时间，如:2018-11-11 11:12"> -->
                    <input class="ipta" type="text" placeholder="年" id="year">年
                    <input class="ipta" type="text" placeholder="月" id="month">月
                    <input class="ipta" type="text" placeholder="日" id="day">日
                </div>
            </div>
            <div class="item">
                <div class="l">行驶里程(万公里)</div>
                <div class="r">
                    <input class="ipt" type="text" name="" id="infoBy3" placeholder="请输入行驶里程(万公里)">
                </div>
            </div>
            <div class="item">
                <div class="l">意向置换车型</div>
                <div class="r">
                    <input class="ipt" type="text" name="" id="infoBy4" placeholder="请填写您的意向置换车型">
                </div>
            </div>
       </div>
       <div class="btn">立即申请置换</div>
    </div>

    <div class="tel">
		<div class="tel-wrap">
			<p class="tit">填写预约信息</p>
			<div class="telipt">
				<input type="text" name="" id="name" placeholder="请输入姓名">
			</div>
			<div class="sex">
				<label for="nan">
					<input type="radio" name="sex" id="nan" value="先生">
					<div class="a">先生</div>
				</label>
				<label for="nv">
					<input type="radio" name="sex" id="nv" value="女士">
					<div class="a">女士</div>
				</label>
			</div>
			<div class="telipt">
				<input type="tel" name="" id="tel" placeholder="请输入手机号">
			</div>
			<!-- <div class="sex">
				<label for="ziyong">
					<input type="radio" name="yuyue-sty" id="ziyong" value="自用">
					<div class="a">自用</div>
				</label>
				<label for="yunying">
					<input type="radio" name="yuyue-sty" id="yunying" value="营运">
					<div class="a">营运</div>
				</label>
			</div> -->
			<div class="itema">
				<input type="password" class="a" id="code1" autocomplete="off" name="" placeholder="短信验证码">
				<input type="button" id="btnSendCode1" class="btn btn-default" value="获取验证码" onclick="sendMessage1()">
			</div>
			<p class="tips">注：预约成功后，我们将会在48小时内联系您，提供1对1专属服务</p>
			<div class="tel-btn">
				<div class="cancel">取消</div>
				<div class="success">确认</div>
			</div>
		</div>
	</div>


    <div class="message-box"></div>
    <script src="../static/js/jquery.min.js"></script>
    <script src="../static/js/rem.js"></script>
    <script src="../static/js/base.js"></script>
    <script src="../static/js/zhihuan.js"></script>
    <script>
		var phoneReg = /(^1[3|4|5|7|8]\d{9}$)|(^09\d{8}$)/;//手机号正则 
		var count = 60; //间隔函数，1秒执行
		var InterValObj1; //timer变量，控制时间
		var curCount1;//当前剩余秒数
		/*第一*/
		function sendMessage1() {
			curCount1 = count;		 		 
			var phone = $.trim($('#tel').val());
			if (!phoneReg.test(phone)) {
				alert("请输入有效的手机号码"); 
				return false;
			}
			//设置button效果，开始计时
			$("#btnSendCode1").attr("disabled", "true");
			$("#btnSendCode1").val( + curCount1 + "秒再获取");
			InterValObj1 = window.setInterval(SetRemainTime1, 1000); //启动计时器，1秒执行一次
			//向后台发送处理数据
			var appCode = 'fxjsms';
			var templateparam = Math.round((Math.random()*9000) + 1000);
			$.ajax({
				type: "GET",
				url: baseUrl + "/rest/base/sendsms?appCode="+appCode+"&phonenumbers="+phone+"&templateparam="+templateparam,
				contentType:"application/json;charset=UTF-8",
				success: function(data){
					let e = JSON.parse(data);
					if(e.ok){
						messageBox("短信验证码已发送！");
					}else{
						messageBox(e.message);
					}
				}
			});
				
		}
		function SetRemainTime1() {
			if (curCount1 == 0) {                
				window.clearInterval(InterValObj1);//停止计时器
				$("#btnSendCode1").removeAttr("disabled");//启用按钮
				$("#btnSendCode1").val("重新发送");
			}
			else {
				curCount1--;
				$("#btnSendCode1").val( + curCount1 + "秒再获取");
			}
		} 
	</script>
</body>
</html>